﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="List.ascx.vb" Inherits="Control_BanHang_List" %>

<script type='text/javascript'>
    function ajaxJquery() {

        $(function () {

            // register thickbox after postback
            var isAsyncPostback = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();
            if (isAsyncPostback) {
                tb_init('a.thickbox, area.thickbox, input.thickbox');
            }
            $(".Date").datepicker({ dateFormat: 'dd/mm/yy' });
            //  $(".TextBox:first").focus();
            //check cookie to show or hide search pannel
            if ($.cookie('CookieSSMSearch') == 1) {
                $('#pnlSearch').show();
            }
            else {
                $('#pnlSearch').hide();
            }

            $('#B1').click(function (event) {

                //set cookie
                if ($.cookie('CookieSSMSearch') == 1) {
                    $.cookie('CookieSSMSearch', 0)
                }
                else {
                    $.cookie('CookieSSMSearch', 1)
                }
                $('#pnlSearch').slideToggle(500);
                if ($('#imgShowHide').attr("src") == "../../images/arrow_popup.gif") {
                    $('#imgShowHide').attr("src", "../../images/arrow_showless.gif");
                }
                else {
                    $('#imgShowHide').attr("src", "../../images/arrow_popup.gif");
                }
            });

        });
    }


    function CheckAll() {
        if (
            $("#<%= grdShow.ClientID %> tr th span").find("input[type=checkbox]").attr("checked") == true) {
            if (
            $("#<%= grdShow.ClientID %> tr td").find("input[type=checkbox]").attr('disabled') != true) {

                $("#<%= grdShow.ClientID %> tr td").find("input[type=checkbox]").attr('checked', true);
            }
        } else {

            $("#<%= grdShow.ClientID %> tr td").find("input[type=checkbox]").attr('checked', false);
        }
    }
    function confirmMultiDelete(strID) {
        var grdShow = document.getElementById("<%=grdShow.ClientID %>");
        var count = 0;
        for (i = 1; i < grdShow.children.item(0).children.length; i++) {
            if (grdShow.children.item(0).children.item(i).children.item(0).children.item(0).checked) {
                count += 1;
            }
        }
        if (count > 0) {
            return ComfirmDialog('<%=drpMessage.Items(1).Text%>', 0, strID, 0, 0);
        } else {
            Alertbox('<%=drpMessage.Items(2).Text%>');
            return false;
        }
    }
    function ComfirmDialog(strText, value, ObjectIdClick, ID, Type) {
        if (value == 0) {
            Confirmbox(strText, value, ObjectIdClick, ID, Type);
            return false;
        } else {
            if (Type == 1) {
                document.getElementById('<%=hidID.ClientID %>').value = ID;
                eval($("#" + ObjectIdClick + "").attr("href"));
            }
            else {
                $("#" + ObjectIdClick + "").click();
            }
        }
    }
</script>

	<asp:UpdatePanel ID="uplBanHang" runat="server">
	 <ContentTemplate>
        <div class="BoxField">
            <div class="HeadTitle">
                <h3>
                    QUẢN LÝ ĐƠN HÀNG</h3>
            </div>
         </div>

         <div class="SubjectTitle" id="SInfor" runat="server">
            <legend class="SubjectTitle">
                <img alt="" src="../../images/arrow_popup.gif" id="imgShowHide" />
                <a id="B1" href="#">Tìm kiếm </a>&nbsp;&nbsp;</legend>
        </div>


        <div id="pnlSearch" class="SubjectTitle">

		<div class="DivRow">
		<div    class="DivLabelSearch">
			Mã đơn hàng:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtBanHangid" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Cửa hàng:
		</div>
		<div  class="DivTextBox" >
			<asp:DropDownList ID="ddlStore" CssClass="TextBox" runat="server" >
            
            </asp:DropDownList>
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Tên khách hàng:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtCustomername" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Địa chỉ:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtAddress" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Người tạo:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtCreator" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Ngày tạo:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtCreated" CssClass="TextBox Date" runat="server" Text="" />
		</div>
		</div>


		<div style="clear:both" ></div>
        <div style="display:none">
		                <div class="DivRow">
		                <div    class="DivLabelSearch">
			                Modifier:
		                </div>
		                <div  class="DivTextBox" >
			                <asp:TextBox ID="txtModifier" CssClass="TextBox" runat="server" Text="" />
		                </div>
		                </div>
		                <div style="clear:both" ></div>
		                <div class="DivRow">
		                <div    class="DivLabelSearch">
			                Modified:
		                </div>
		                <div  class="DivTextBox" >
			                <asp:TextBox ID="txtModified" CssClass="TextBox" runat="server" Text="" />
		                </div>
		                </div>
		                <div style="clear:both" ></div>

        </div>

		<div class="DivRow">
		<div    class="DivLabelSearch">
			Email:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtEmail" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			Phone:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtPhone" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div    class="DivLabelSearch">
			(Đơn hàng) ngày:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtBanHangdate" CssClass="TextBox Date" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow" style="display:none">
		<div    class="DivLabelSearch">
			IseditBanHangdate:
		</div>
		<div  class="DivTextBox" >
			<asp:TextBox ID="txtIseditBanHangdate" CssClass="TextBox" runat="server" Text="" />
		</div>
		</div>
		<div style="clear:both" ></div>
		<div class="DivRow">
		<div class="DivLabelSearch" >&nbsp;&nbsp;&nbsp;</div>
		<div class="DivTextBox" >
			<asp:Button ID="btnSearch" runat="server" Text=" Tìm kiếm" CssClass="btn" />
			<asp:Button ID="btnReset" runat="server" Text="Hủy" CssClass="btn" />&nbsp;		</div>
		</div>
		<div style="clear:both; height:10px" ></div>
	</div>
	
	<asp:GridView ID="grdShow" runat="server" AutoGenerateColumns="False" EmptyDataText="{Không có dữ liệu}"
		   AllowPaging="false"   Width='100%' BBanHangWidth="1px" CssClass="GridBBanHang">
		    <Columns>
		<asp:TemplateField>
		    <HeaderTemplate>
			        <asp:CheckBox ID="CheckAll" runat="server" onclick="CheckAll();"  Width="30px" />
		    </HeaderTemplate>
		    <HeaderStyle HorizontalAlign="Center" />
		     <ItemTemplate>
			        <asp:CheckBox ID="chkItem" runat="server" />
		     </ItemTemplate>
		     <ItemStyle Width="5%" HorizontalAlign="Center" />
		 </asp:TemplateField>
	<asp:TemplateField>
	<ItemTemplate>
		   <asp:HyperLink ID="hplEdit" runat="server" Text="Sửa"></asp:HyperLink>&nbsp;|&nbsp;
		   <asp:LinkButton ID="lnkbtnDelete" Text="Xóa" runat="server" OnClick="lnkbtnDelete_Click"
			       CausesValidation='False'></asp:LinkButton>
	</ItemTemplate>
	<ItemStyle CssClass="GridTextLink" HorizontalAlign="Center" Width="10%" />
	</asp:TemplateField>
	<asp:TemplateField HeaderText="No">
		  <ItemTemplate>
			    <asp:Label runat="server" ID="lblSTT" Text=''></asp:Label>
	 </ItemTemplate>
		  <ItemStyle Width="5%"  HorizontalAlign="Left" />
	</asp:TemplateField>
		 <asp:TemplateField HeaderText='Mã đơn hàng'>
		  <ItemTemplate>
			    <asp:HyperLink ID="hplBanHangid" runat="server"></asp:HyperLink>
		 </ItemTemplate>
		 <ItemStyle Width='10%' CssClass='text_list_links' HorizontalAlign='Left' />
		</asp:TemplateField>
		 <asp:BoundField DataField='StoreName' HeaderText='Cửa hàng'>
			 <ItemStyle  Width='10%' />
		 </asp:BoundField>
	     <asp:BoundField DataField='BanHangDate' HeaderText='(Đơn hàng) ngày'  DataFormatString="{0:dd/MM/yyyy}" >
			 <ItemStyle  Width='10%' />
    		 </asp:BoundField>
	     <asp:BoundField DataField='GrossAmount' HeaderText='Thành tiền'  DataFormatString="{0:##,###}" >
			 <ItemStyle  Width='10%' />
    		 </asp:BoundField>
		 <asp:BoundField DataField='CustomerName' HeaderText='Tên khách hàng'>
			 <ItemStyle  Width='10%' />
		 </asp:BoundField>
		 <asp:BoundField DataField='Address' HeaderText='Địa chỉ'>
			 <ItemStyle  Width='15%' />
		 </asp:BoundField>
		
        
        <asp:BoundField DataField='Creator' HeaderText='Người tạo'>
			 <ItemStyle  Width='10%' />
		 </asp:BoundField>

		 <asp:BoundField DataField='Created' HeaderText='Ngày tạo'  DataFormatString="{0:dd/MM/yyyy HH:mm}" >
			 <ItemStyle  Width='10%' />
		 </asp:BoundField>

	
		
	</Columns>
	 <HeaderStyle Height="26px" HorizontalAlign="Left" CssClass="GridHeader" />
	 <RowStyle CssClass="GridRow" Height="23px" />
	 <AlternatingRowStyle CssClass="GridAlterRow" />
	 <PagerStyle CssClass="GridPaged" HorizontalAlign="Right" Height="23px" />
	 <PagerSettings Mode="Numeric" PageButtonCount="2" />
	 <EmptyDataRowStyle CssClass="GridTextEmpty" HorizontalAlign="Center" />
	</asp:GridView>
	<div><asp:Button ID="btnDelete" CssClass="btn" runat="server" Text="Xóa" /> <asp:Label ID="lblPage_Size" runat="server" Text="Số bản ghi trên trang:" ></asp:Label>		 <asp:DropDownList ID="drpPage_Size" runat="server" AutoPostBack="True" Width="70px" CssClass="input_form">
		 <asp:ListItem Text="10" Value="10"></asp:ListItem>
		 <asp:ListItem Text="20" Value="20"></asp:ListItem>
		 <asp:ListItem Text="50" Value="50"></asp:ListItem>
		 <asp:ListItem Text="100" Value="100"></asp:ListItem>
		 </asp:DropDownList>
		  <asp:Label ID="lblTotal" runat="server"></asp:Label></div>
	<div style="width: 100%">
		 <!--phan trang-->
		 <div id="results_resultsNavigationDiv" class="paginationEMP">
		 <ul>
		     <asp:LinkButton ID="lnkFirst" runat="server"></asp:LinkButton>
		     <asp:Repeater ID="rptPage" runat="server">
		         <ItemTemplate>
		              <asp:LinkButton ID="lnkTitle" CssClass="page_num" runat="server" OnClick="lnkTitle_Click"></asp:LinkButton>
		         </ItemTemplate>
		    </asp:Repeater>
		    <asp:LinkButton ID="lnkLast" runat="server"></asp:LinkButton>
		   </ul>
		  </div>
		  <asp:HiddenField ID="hidCount" Value="0" runat="server" />
		 <asp:HiddenField ID="hidIndex_page" Value="0" runat="server" />
		 <asp:HiddenField ID="hidCur_Page" Value="1" runat="server" />
		  </div>
	<div style='display: none'>
	<asp:DropDownList ID="drpMessage" runat="server" >
		  <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản ghi này không?' Value='0'></asp:ListItem>
		   <asp:ListItem Text='Bạn có chắc chắn muốn xóa bản đã chọn?' Value='1'></asp:ListItem>
	 <asp:ListItem Text='Bạn phải chọn ít nhất một bản ghi.' Value='2'></asp:ListItem>
	</asp:DropDownList>
	 <asp:HiddenField ID="hidID" Value="0" runat="server" />
	</div>
	</ContentTemplate>
	</asp:UpdatePanel>

